﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RDPRemoteObject
{
    public class FaxBusiness : MarshalByRefObject, RDPCommon.IFaxBusiness
    {
        public static object privateObjectLock = new object();

        public static event RDPCommon.FaxEventHandler FaxSendedEvent;
        BroadCast m_BroadCast = new BroadCast();

        public object[] SendFax(object[] clientIds, string fax)
        {
            lock (privateObjectLock)
            {
                object[] rtn = new object[] { 0, null };
                m_BroadCast.BroadCastingInfo(clientIds, fax);
                if (FaxSendedEvent != null)
                {
                    FaxSendedEvent(fax);
                }
                else
                {
                    rtn[0] = 1;
                    Exception ex = new Exception("服务端没有启动会话,暂时收不到您的消息.");
                    ex.Source = this.GetType().ToString();
                    rtn[1] = ex;
                }
                return rtn;
            }
        }

        public override object InitializeLifetimeService()
        {
            return null;
        }
    }


}
